using System.Collections.Generic;

namespace RikMigrations
{
    public class StoredProcedure
    {
        internal DbProvider provider;

        private IList<Command> commands = new List<Command>();

        private string name;
        public string Name
        {
            get { return name; }
        }

        private string script;
        public string Script
        {
            get { return script; }
        }
        
        public StoredProcedure (DbProvider provider, string name, string script)
        {
            this.provider = provider;
            this.name = name;
            this.script = script;
        }

        public void Save()
        {
            foreach (Command cmd in commands)
                cmd.Execute(provider);
            commands.Clear();
        }
    }
}